home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SNNSV32.ZIP / SNNSv3.2 / kernel / sources / krui_typ.h < prev    next >
Text File  |  1994-04-25  |  52KB  |  1,586 lines

  1. /*****************************************************************************
  2.   FILE           : krui_typ.h
  3.   SHORTNAME      : 
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        : SNNS-Kernel User Interface Function Prototypes
  7.   NOTES          : ANSI-C only
  8.  
  9.   AUTHOR         : Niels Mache
  10.   DATE           : 27.02.90
  11.  
  12.   CHANGED BY     : Sven Doering
  13.   IDENTIFICATION : @(#)krui_typ.h       1.4 2/11/93
  14.   SCCS VERSION   : 1.4
  15.   LAST CHANGE    : 2/11/93
  16.  
  17.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  18.  
  19. ******************************************************************************/
  20.  
  21.  
  22. /* -----------------------    THAT'S NEW:   -------------------------------
  23.  
  24.  
  25. Development History of the SNNS Kernel (reverse order):
  26.  
  27. ******************************************************************************
  28.  
  29. 22.07.92:
  30.    NEW FUNCTIONS:
  31.      A set of new activation/initialization/learning functions for make use of
  32.      Radial Basis Functions. Changes in:
  33.      trans_f.c
  34.      init_f.c
  35.      learn_f.c
  36.      func_tbl.c
  37.    NEW MODULES:
  38.      matrix.c
  39.      matrix.h
  40.       - general purpose matrix operations
  41.      
  42. *******************************************************************************
  43.  
  44.  
  45. *******************************************************************************
  46.  
  47. 22.05.92:
  48.    NEW FUNCTIONS:
  49.      krui_saveResult( ... )
  50.       - saves a result file. Depends on the current loaded net and patterns
  51.  
  52. *******************************************************************************
  53.  
  54. *******************************************************************************
  55.  
  56. SNNS Kernel Version 2.1 with parallel kernel capability:
  57.  
  58. 1.01.92:
  59.    CHANGES:
  60.      krui_deleteLink(),
  61.      krui_deleteAllInputLinks(),
  62.      krui_deleteAllOutputLinks()
  63.        now returns and error code.
  64.  
  65.      krui_getCurrentSuccUnit( ... )
  66.        has been removed from the interface.
  67.  
  68.    NEW FUNCTIONS:
  69.      krui_setSpecialNetworkType( ... )
  70.       - sets the topologic type of the current network.
  71.  
  72.      krui_getSpecialNetworkType()
  73.       - returns the special topologic type of the current network, if set.
  74.  
  75.      krui_MasPar( ... )
  76.       - connects and disconnects the MasPar.
  77.  
  78.      krui_getMasParStatus()
  79.       - returns the status of the MasPar.
  80.  
  81.      krui_newVectorPatternPair( ... )
  82.       - creates a new pattern vector.
  83.  
  84.      krui_getPatternArrays( ... )
  85.       - determines the addresses of the internal pattern arrays.
  86.  
  87.      krui_allocatePatterns( ... )
  88.       - allocate pattern pairs.
  89.  
  90.      krui_setNoOfPatterns( ... )
  91.       - set the number of available pattern pairs.
  92.  
  93.  
  94. *******************************************************************************
  95.  
  96. SNNS Kernel Version 2.0:
  97.  
  98. 21.08.91:
  99.    NEW FUNCTIONS:
  100.      krui_searchUnitName( ... )
  101.        - searches for a unit with the given name
  102.      krui_searchNextUnitName()
  103.        - searches for the next unit with the given name
  104.      krui_testNet( ... )
  105.        - calculates the network error whith a given pattern
  106.      krui_getNoOfTTypeUnits( ... )
  107.        - returns the no. of units of the specified topologic type
  108.        (should now be used instead of "krui_getNoOfInputUnits" and
  109.     "krui_getNoOfOutputUnits")
  110.  
  111.      krui_getFuncParamInfo( ... )
  112.        - returns the no. of input and output parameters of the given function
  113.  
  114.  
  115.    NEW FUNCTIONS for the 3D-Kernel:
  116.      krui_getXYTransTable( ... )
  117.        - returns the pointer of the XY-Translation Table
  118.  
  119.      krui_getUnitCenters( ... )
  120.        - returns the 3D transform center of the specified unit and center number
  121.  
  122.      krui_setUnitCenters( ... )
  123.        - sets the 3D transform center of the specified unit and center number
  124.  
  125.  
  126. *******************************************************************************
  127.  
  128. SNNS Kernel Version 1.3:
  129.  
  130. 26.04.91:
  131.    CHANGES:
  132.       krui_showPattern( mode ) 
  133.       - has now only one parameter <mode> (the parameter <pattern_no> has left)
  134.         krui_showPattern(...) shows now the CURRENT pattern.
  135.         
  136.       - The pattern file format has been changed but the scanner is downward kompatible.
  137.         The new file format has now a SNNS-header with time stamp and is better readable.
  138.         Comments (beginning with a #) are also possible.
  139.  
  140.    NEW FUNCTIONS:
  141.      krui_setPatternNo( ... )
  142.        - sets the current pattern for access
  143.      krui_deletePattern()
  144.        - deletes the current pattern
  145.      krui_modifyPattern()
  146.        - modifies the current pattern
  147.  
  148.  
  149.  
  150. *******************************************************************************
  151.  
  152. SNNS Kernel Version 1.2:
  153.  
  154. 18.03.91:
  155.    CHANGES:
  156.      krui_randomizeWeights( ... )  
  157.        - has been removed from the user interface
  158.      krui_updateNet( ... )
  159.        - parameters of krui_updateNet has changed
  160.  
  161.    NEW FUNCTIONS:
  162.      krui_setInitialisationFunc( ... )
  163.        - sets the initialisation function (i.e. randomize weights)
  164.      krui_getInitialisationFunc()
  165.        - returns the current initialisation function
  166.      krui_initializeNet( ... )
  167.        - initializes the net with the current initialisation function
  168.      krui_setUpdateFunc( ... )
  169.        - sets the update function (i.e. serial propagation)
  170.      krui_getUpdateFunc()
  171.        - returns the current update function
  172.      krui_updateNet( ... )
  173.        - updates the network
  174.  
  175. *******************************************************************************
  176.  
  177.  
  178.  
  179. *******************************************************************************
  180.  
  181. SNNS Kernel Version 1.1:
  182.  
  183. 19.12.90:
  184.    CHANGES:
  185.      krui_learnAllPatterns( ... ) and krui_learnSinglePattern( ... )
  186.      have parameter arrays now. The return type has changed to krui_err. 
  187.  
  188.    NEW FUNCTIONS:
  189.      krui_getLearnFunc( ... )
  190.        - Returns the name of the current learning function
  191.      krui_setLearnFunc( ... )
  192.        - Changes the learning function
  193.  
  194.         
  195. *******************************************************************************
  196.  
  197. ###############################################################################
  198.  
  199. 18.10.90  SNNS Kernel Version 1.0
  200.  
  201. ###############################################################################
  202.  
  203.  
  204. 18.10.90:
  205.    NEW FUNCTIONS:
  206.      krui_getUnitNoNearPosition( ... )
  207.        - Returns the unit no. near the given position 
  208.  
  209.  
  210. 04.10.90:
  211.    CHANGES:
  212.      krui_getUnitNoAtPosition( ... )  needs now another parameter <subnet_no>.
  213.  
  214.  
  215. 25.09.90:
  216.    NEW FUNCTIONS:
  217.      krui_randomizeWeights( ... )
  218.        - Initializes connection weights with uniform distributed random values.
  219.  
  220.      krui_jogWeights( ... )
  221.        - Add uniform distributed random values to connection weights.
  222.  
  223.      krui_areConnected( ... )
  224.        - Determines a connection AND the attached site between two units
  225.          and returns the connection weight.
  226.  
  227.  
  228. 05.06.90:
  229.    NEW FUNCTIONS:
  230.      krui_setSite( char    *site_name )
  231.        -  initializes the given site at the current unit.
  232.  
  233.  
  234. 04.06.90:
  235.    All Symbols (Unit, Site, FType) will be spelling checked now.
  236.    Symbols must match ([A-Za-z]^[|, ]*).
  237.  
  238.    krui_loadNet( ... )
  239.     - now admit user friendly free style format
  240.     - loads default presettings
  241.  
  242.    krui_saveNet( ... )  now saves default presettings.
  243.  
  244.    NEW FUNCTIONS:  krui_getUnitDefaults( ... ) and
  245.                    krui_setUnitDefaults( ... )
  246.  
  247.                    - Determines and changes the default presettings.
  248.                    NOTE: Presettings may now be changed dynamically, i.e
  249.                          during creation of units.
  250.  
  251.  
  252. 29.05.90:
  253.    NEW FUNCTIONS:
  254.       krui_getMemoryManagerInfo( ... )
  255.        - returns the number of ALLOCATED (not the number of USED) bytes
  256.          for the units, sites, name-table and site-table.
  257.  
  258.       krui_getNetInfo( ... )
  259.        -  returns miscellanous information about the current network.
  260.  
  261.       krui_getVersion()
  262.        -  returns the current version of the SNNS-Kernel.
  263.  
  264.  
  265. *******************************************************************************
  266.  
  267.  
  268.     For additional type definitions and constants see include file "glob_typ.h" !
  269.     For kernel user interface function prototypes use this file !
  270. */
  271.  
  272.  
  273.  
  274. /*#################################################
  275.  
  276. GROUP: Unit Functions
  277.  
  278. #################################################*/
  279.  
  280.  
  281. int  krui_getNoOfUnits( void );
  282. /*  Returns the number of units used by the network.
  283. */
  284.  
  285. int  krui_getFirstUnit( void );
  286. /*  Initializes the first available unit for access. If the unit has sites, the
  287.     first site will be set to the current site.
  288.     Returns the unit no. of the first unit or 0 if no units available.
  289. */
  290.  
  291. int  krui_getNextUnit( void );
  292. /*  Initializes the next available unit for access. If the unit has sites, the
  293.     first site will be set to the current site.
  294.     Returns the unit no. of the next unit or 0 if no more units available.
  295. */
  296.  
  297. int  krui_getCurrentUnit( void );
  298.      /*  Returns the no. of the current unit or 0 if no units available.
  299.      */
  300.  
  301. krui_err    krui_setCurrentUnit( int  UnitNo );
  302. /*  Initializes a unit for access. If the unit has sites, the first site
  303.     will be set to the current site.
  304.     Returns error code if the given unit doesn't exist, 0 otherwise.
  305. */
  306.  
  307.  
  308. char  *krui_getUnitName( int  UnitNo );
  309. /*  Returns the name of the unit. (NULL if not available).
  310. */
  311.  
  312. krui_err  krui_setUnitName( int  UnitNo, char * unit_name );
  313. /*  Sets the name of the unit <UnitNo>.
  314.     If the unit_name pointer is NULL, the unit's symbol will be deleted.
  315.     Function has no effect on the current unit.
  316.     Returns error code if memory allocation fails, 0 otherwise.
  317. */
  318.  
  319. int  krui_searchUnitName( char  *unit_name );
  320. /*  Searches for a unit with the given name.
  321.     Returns the first unit no. if a unit with the given name was found,
  322.     0 otherwise.
  323.  
  324.     Returns error code if no units defined.
  325. */
  326.  
  327. int  krui_searchNextUnitName( void );
  328. /*  Searches for the next unit with the given name.
  329.     Returns the next unit no. if a unit with the given name was found,
  330.     0 otherwise.
  331.  
  332. NOTE: Call krui_searchUnitName( unit_name ) before calling krui_searchNextUnitName().
  333.  
  334. Returns error code if no units defined.
  335. */
  336.  
  337.  
  338.  
  339. char  *krui_getUnitOutFuncName( int  UnitNo );
  340. /*  Returns the output function name of the unit.
  341.     Do not use invalid unit numbers!
  342. */
  343.  
  344. krui_err   krui_setUnitOutFunc( int  UnitNo, char *  unitOutFuncName );
  345. /*  The unit's FType will be set to 0, i.e. the
  346.     unit's functionality type will be deleted.
  347.     Function has no effect on the current unit.
  348.     Do not use invalid unit numbers!
  349. NOTE: Returns 0, if the function is a valid output function,
  350.       error code otherwise.
  351. */
  352.  
  353. char  *krui_getUnitActFuncName( int  UnitNo );
  354. /*  Returns the activation function name of the unit.
  355.     Do not use invalid unit numbers!
  356. */
  357.  
  358. krui_err  krui_setUnitActFunc( int  UnitNo, char *  unitActFuncName );
  359. /*  The unit's FType will be set to 0, i.e. the
  360.     unit's functionality type will be deleted.
  361.     Function has no effect on the current unit.
  362.     Do not use invalid unit numbers!
  363. NOTE: Returns 0, if the function is a valid activation function,
  364.       error code otherwise.
  365. */
  366.  
  367.  
  368. char  *krui_getUnitFTypeName( int UnitNo );
  369. /*  Returns the functionality type name of the unit.
  370.     Function has no effect on the current unit.
  371.     Returns NULL if unit has no FType.
  372.     Do not use invalid unit numbers!
  373. */
  374.  
  375.  
  376. FlintType   krui_getUnitActivation( int  UnitNo );
  377. /*  Returns the activation value of the unit.
  378.     Function has no effect on the current unit.
  379.     Do not use invalid unit numbers!
  380. */
  381.  
  382. krui_err  krui_setUnitActivation(int  UnitNo, FlintTypeParam  unit_activation);
  383. /*  Sets the activation value of the unit.
  384.     Function has no effect on the current unit.
  385.     Do not use invalid unit numbers!
  386. */
  387.  
  388. FlintType  krui_getUnitInitialActivation( int  UnitNo );
  389. /*  Returns the initial activation value of the unit.
  390.     Function has no effect on the current unit.
  391.     Do not use invalid unit numbers!
  392. */
  393.  
  394. void  krui_setUnitInitialActivation( int  UnitNo, FlintTypeParam  unit_i_activation );
  395. /*  Sets the initial activation value of the unit.
  396.     Function has no effect on the current unit.
  397.     Do not use invalid unit numbers!
  398. */
  399.  
  400. FlintType  krui_getUnitOutput( int  UnitNo );
  401. /*  Returns the output value of the unit.
  402.     Function has no effect on the current unit.
  403.     Do not use invalid unit numbers!
  404. */
  405.  
  406. krui_err  krui_setUnitOutput( int  UnitNo, FlintTypeParam  unit_output );
  407. /*  Sets the output value of the unit.
  408.     Function has no effect on the current unit.
  409.     Do not use invalid unit numbers!
  410. */
  411.  
  412.  
  413. FlintType  krui_getUnitBias( int  UnitNo );
  414. /*  Returns the bias value of the unit.
  415.     Function has no effect on the current unit.
  416.     Do not use invalid unit numbers!
  417. */
  418.  
  419. void  krui_setUnitBias( int  UnitNo, FlintTypeParam  unit_bias );
  420. /*  Sets the bias value of the unit.
  421.     Function has no effect on the current unit.
  422.     Do not use invalid unit numbers!
  423. */
  424.  
  425.  
  426. int   krui_getUnitSubnetNo( int UnitNo );
  427. /*  Returns the subnet number of the unit.
  428.     Function has no effect on the current unit.
  429. NOTE: The range of the subnet no. is -32736...+32735
  430.     Do not use invalid unit numbers!
  431. */
  432.  
  433. void  krui_setUnitSubnetNo( int UnitNo, int  subnet_no);
  434. /*  Sets the subnet number of the unit.
  435.     Function has no effect on the current unit.
  436. NOTE: The range of the subnet no. is -32736...+32735
  437.     Do not use invalid unit numbers!
  438. */
  439.  
  440. unsigned short  krui_getUnitLayerNo( int UnitNo );
  441. /*  Returns the layer number of the unit.
  442.     Function has no effect on the current unit.
  443. NOTE: Bit fields are 16 bit integers
  444.     Do not use invalid unit numbers!
  445. */
  446.  
  447. void  krui_setUnitLayerNo( int UnitNo, int layer_bitField );
  448. /*  Sets the layer number of the unit.
  449.     Function has no effect on the current unit.
  450. NOTE: Bit fields are 16 bit integers
  451.     Do not use invalid unit numbers!
  452. */
  453.  
  454. void  krui_getUnitPosition( int  UnitNo, struct PosType  *position );
  455. /*  Returns the position of the unit.
  456.     Function has no effect on the current unit.
  457.     Do not use invalid unit numbers!
  458.  
  459. NOTE: See include file glob_typ.h for PosType definition !
  460. */
  461.  
  462. void  krui_setUnitPosition( int  UnitNo, struct PosType  *position );
  463. /*  Sets the position of the unit.
  464.     Function has no effect on the current unit.
  465.     Do not use invalid unit numbers!
  466.  
  467. NOTE: See include file glob_typ.h for PosType definition !
  468. */
  469.  
  470.  
  471. int  krui_getUnitNoAtPosition( struct PosType  *position, int subnet_no );
  472. /*  Returns the unit no. at the given position and the specified
  473.     subnet no or 0, if no unit exists at this position.
  474.     Function has no effect on the current unit.
  475.  
  476. NOTE: This function is slow because it uses linear search to
  477.       find the unit with the given position.
  478.  
  479. REMARK: getUnitNoAtPosition is for downward compatibility only.
  480.         Do not use this function in future applications.
  481. */
  482.  
  483. int  krui_getUnitNoNearPosition( struct PosType  *position, int subnet_no ,
  484.                                  int range, int gridWidth );
  485. /*  Returns the unit no. near the given position and the specified
  486.     subnet no or 0, if no unit exists at this position.
  487.     Function has no effect on the current unit.
  488.  
  489. NOTE: This function is slow because it uses linear search to
  490.       find the unit with the given position.
  491. */
  492.  
  493. #ifdef KERNEL3D
  494. /*  Functions for the 3D-Kernel  */
  495. krui_err  krui_getUnitCenters( int unit_no, int center_no, struct PositionVector  * *unit_center );
  496. /*  Returns the 3D transform center of the specified unit and center number.
  497.     Function has no effect on the current unit.
  498.     Returns error number if unit or center no. is invalid
  499. */
  500.  
  501. krui_err  krui_setUnitCenters( int unit_no, int center_no, struct PositionVector  *unit_center );
  502. /*  sets the 3D transform center of the specified unit and center number
  503.     Function has no effect on the current unit.
  504.     Returns error number if unit or center no. is invalid
  505. */
  506.  
  507. krui_err  krui_xyTransTable(int op, int *x, int *y, int z);
  508. /*  Returns the x y coordinate of the given z-value.
  509.     Returns error code if the SNNS-Kernel isn't a 3D-Kernel.
  510. */
  511.  
  512. #else
  513. /*  dummy functions for the 2D-Kernel  */
  514. krui_err  krui_getUnitCenters( int, int, int );
  515. krui_err  krui_setUnitCenters( int, int, int );
  516. krui_err  krui_getXYTransTable( int, int *, int * );
  517.  
  518. #endif
  519.  
  520.  
  521.  
  522. int  krui_getUnitTType( int  UnitNo );
  523. /*  Returns the topologic type, i.e. input, output, hidden
  524.     Function has no effect on the current unit.
  525.  
  526. NOTE: See include file glob_typ.h for TType constants !
  527.  
  528.     Do not use invalid unit numbers!
  529. */
  530.  
  531. krui_err  krui_setUnitTType( int  UnitNo, int  UnitTType );
  532. /*  Sets the topologic type of the unit.
  533.     Function has no effect on the current unit.
  534.  
  535. NOTE: See include file glob_typ.h for TType constants !
  536.  
  537.     Returns error code if topologic type or unit number is invalid.
  538. */
  539.  
  540. krui_err  krui_freezeUnit( int  UnitNo );
  541. /*  Freezes the output of a unit, i.e. the unit is disabled.
  542.     Function has no effect on the current unit.
  543.     Do not use invalid unit numbers!
  544. */
  545.  
  546. krui_err  krui_unfreezeUnit( int  UnitNo );
  547. /*  Disabels a previosly freezed unit.
  548.     Function has no effect on the current unit.
  549.     Do not use invalid unit numbers!
  550. */
  551.  
  552. bool  krui_isUnitFrozen( int  UnitNo );
  553. /*  Returns true, if unit is frozen
  554.     Do not use invalid unit numbers!
  555. */
  556.  
  557.  
  558. int  krui_getUnitInputType( int UnitNo );
  559. /*  Returns the input type of the unit:
  560.      NO_INPUTS    : if the unit has not inputs (at least not now)
  561.      SITES        : if the unit has one or more sites (and no direct input links !)
  562.      DIRECT_LINKS : if the unit has direct input links (and no sites !)
  563.  
  564.     Function has no effect on the current unit.
  565.  
  566. NOTE: See include file glob_typ.h for input type constants !
  567. */
  568.  
  569. /*  *************************************   */
  570.  
  571. int  krui_createDefaultUnit( void );
  572. /*  Creates a unit with default properties:
  573.     1. default activation and output functions
  574.     2. default activation and bias
  575.     3. default position, subnet and layer number
  576.     4. no functionality type
  577.     5. no sites
  578.     6. no inputs and outputs
  579.     7. no unit_name
  580.  
  581.     Returns an (negative) error code, if memory allocation fails or
  582.     invalid functions occured. Returns (positive) unit number otherwise.
  583.     Function has no effect on the current unit.
  584.  
  585. NOTE: See file "kr_def.h" for more details about default presettings.
  586. */
  587.  
  588. int  krui_createUnit( char  *unit_name, char  *out_func_name, char  *act_func_name,
  589.                       FlintTypeParam  i_act,  FlintTypeParam  bias);
  590. /*  Creates a user defined unit.
  591.     Returns an (negative) error code, if memory allocation fails or
  592.     invalid functions occured. Returns (positive) unit number otherwise.
  593.     Function has no effect on the current unit.
  594.  
  595.     Unit has additional default settings:
  596.     1. default position, subnet and layer number
  597.     2. no functionality type
  598.     3. no sites
  599.     4. no inputs and outputs
  600.  
  601. */
  602.  
  603.  
  604. krui_err  krui_deleteUnit( int UnitNo );
  605. /*  Deletes a unit from network. Removes all links to other
  606.     units. Returns error code if unit doesn't exist.
  607. */
  608.  
  609. int  krui_createFTypeUnit( char *  FType_name);
  610. /*  creates a unit with FType properties, but:
  611.     1. no inputs and outputs
  612.     2. default position, subnet and layer
  613.  
  614.     Returns the unit number or (negative) error code if memory allocation
  615.     fails or functionality type isn't defined.
  616.     Function has no effect on the current unit.
  617. */
  618.  
  619.  
  620. krui_err  krui_setUnitFType( int  UnitNo, char *  FTypeName );
  621. /*  Changes the properties of unit <UnitNo> to FType properties.
  622.  
  623.     Returns an error code if
  624.      - FType name doesn't exist or
  625.      - unit doesn't exist or
  626.      - memory allocation fails
  627.      otherwise 0.
  628.  
  629.     Function has no effect on the current unit.
  630. */
  631.  
  632.  
  633. int  krui_copyUnit( int  UnitNo, int  copy_mode);
  634. /*  Copy a given unit, according to the copy mode
  635.         1. copy unit (with it sites, if available) and input/output links
  636.         2. copy unit (with it sites, if available) and input links
  637.         3. copy unit (with it sites, if available) and output links
  638.         4. copy unit (with it sites, if available) but no input/output links
  639.  
  640.     Returns the unit number of the new unit or error message < 0 , if errors occured.
  641.     Function has no effect on the current unit.
  642.  
  643. NOTE: Copying of output links is slow.
  644.       If return code < 0, an error occured.
  645.  
  646.       See include file glob_typ.h for copy mode constants !
  647.  
  648. */
  649.  
  650.  
  651. /*#################################################
  652.  
  653. GROUP: Functions for manipulation of the Unit-Functionality-List
  654. REMEMBER: The Unit-Functionality-List stores:
  655.             1. unit activation and output functions
  656.             2. if sites:  3. all site functions
  657.                           4. all site names
  658.  
  659.  
  660. #################################################*/
  661.  
  662. bool  krui_setFirstFTypeEntry( void );
  663. /*  Initializes the first FType entry.
  664.     Returns true, if an entry is available
  665. */
  666. bool  krui_setNextFTypeEntry( void );
  667. /*  Initializes the next FType entry.
  668.     Returns true, if an entry is available
  669. */
  670.  
  671. bool  krui_setFTypeEntry( char *Ftype_symbol );
  672. /*  Initializes the FType entry with the given name.
  673.     Returns true, if an entry with this name is available.
  674. */
  675.  
  676. char *krui_getFTypeName( void );
  677. /*  Returns the name of the current FType entry.
  678. NOTE: The FType name is definite and will never be
  679.       a NULL pointer.
  680. */
  681.  
  682. krui_err  krui_setFTypeName( char  *unitFType_name );
  683. /*  Sets the name of the current FType entry.
  684.     Returns error code if memory allocation fails or Ftype name
  685.     isn't definite, 0 otherwise.
  686. NOTE: The new FType name have to be definite and must not be
  687.       a NULL pointer.
  688. */
  689.  
  690. char  *krui_getFTypeActFuncName( void );
  691. /*  Returns the name of the activation function in the current
  692.     FType entry.
  693. */
  694.  
  695. krui_err  krui_setFTypeActFunc( char * act_func_name );
  696. /*  Sets the activation function in the current FType entry
  697.     returns 0, if the function is a valid activation function,
  698.     error code otherwise.
  699.     All units (in the existing network) of the current Ftype changes
  700.     their activation function.
  701. */
  702.  
  703. char  *krui_getFTypeOutFuncName( void );
  704. /*  Returns the name of the output function in the current
  705.     FType entry.
  706. */
  707.  
  708. krui_err  krui_setFTypeOutFunc( char * out_func_name );
  709. /*  Sets the output function in the current FType entry
  710.     Returns 0, if the function is a valid output function,
  711.     error code otherwise.
  712.     All units (in the existing network) of the current Ftype changes
  713.     their output function.
  714. */
  715.  
  716. /*  FType sites
  717. */
  718. bool  krui_setFirstFTypeSite( void );
  719. /*  Initializes the first site of the current FType.
  720.     Returns FALSE, if no sites are available in the current
  721.     FType entry.
  722. */
  723.  
  724. bool  krui_setNextFTypeSite( void );
  725. /*  Initializes the next FType site.
  726.     Returns FALSE, if no more sites are available in the current
  727.     FType entry.
  728. */
  729.  
  730. char  *krui_getFTypeSiteName( void );
  731. /*  Returns the name of the current FType site (in the current
  732.     Ftype entry).
  733. */
  734.  
  735. krui_err  krui_setFTypeSiteName( char *  FType_site_name );
  736. /*  Sets the name and function of the current FType site (in the
  737.     current FType entry).
  738.     All sites (in the existing network) of the current Ftype and the
  739.     same (old) name changes their names and site functions.
  740.  
  741.     Returns an error code if
  742.       - current Ftype site isn't defined
  743.       - site name does not exist in the site name table
  744.       0 otherwise.
  745. */
  746.  
  747. krui_err  krui_createFTypeEntry( char *  FType_symbol,
  748.                                  char *  act_func, char *  out_func,
  749.                                  int  no_of_sites, char * *array_of_site_names );
  750.  
  751. /*  Create a new functionality type, needs a definite FType symbol,
  752.     the unit output and activation function
  753.     and the number of sites provided for this unit FType.
  754.     An additional array with N elements of pointers to site names
  755.     is required for the definition of the sites.
  756.  
  757.     Returns error code if:
  758.      - memory allocation fails
  759.      - FType name isn't definite (symbol is used for another FType
  760.        or symbol is a NULL pointer)
  761.      - one or more site names are undefined
  762.  
  763.      0 otherwise.
  764.  
  765. NOTE: The number of Ftype entries and the number of sites per Ftype is
  766.       only limited by the size of system memory.
  767. */
  768.  
  769. krui_err  krui_deleteFTypeEntry( char  *FType_symbol );
  770. /*  Deletes the specified FType entry. If there exists units in the
  771.     network with this FType, all these units will lost their FType
  772.     but the functionality of the units will not be changed.
  773.     Returns error code if FType symbol dosn't exist, 0 otherwise.
  774. */
  775.  
  776.  
  777. /*#################################################
  778.  
  779. GROUP: Functions for reading of the function table
  780.        The function table holds the names, types and no. of parameters
  781.        of all functions (transfer, propagate, learning and initialisation
  782.        functions)
  783.  
  784. #################################################*/
  785.  
  786. int  krui_getNoOfFunctions( void );
  787. /*  Returns the number of available functions
  788. */
  789.  
  790. void  krui_getFuncInfo( int  func_no, char * *func_name, int  *func_type );
  791. /*  Returns the name of the function and the function type (Output,
  792.     Activation, Site).
  793.  
  794.     NOTE: See include file glob_typ.h for function type constants !
  795. */
  796.  
  797. bool  krui_isFunction( char  *func_name, int  func_type );
  798. /*  Returns true if the given function name and type exists.
  799.  
  800.     NOTE: See include file glob_typ.h for function type constants !
  801. */
  802.  
  803. bool  krui_getFuncParamInfo( char *func_name, int  func_type,
  804.                              int *no_of_input_params,
  805.                              int *no_of_output_params );
  806.  
  807. /*  Returns the no. of input and output parameters of the given
  808.     function (only relevant for learning, update and initialisation
  809.     functions).
  810.  
  811.     Returns TRUE if the given function exists, FALSE otherwise.
  812. */
  813.  
  814. /*#################################################
  815.  
  816. GROUP: Site Table Functions
  817.  
  818. #################################################*/
  819.  
  820. bool  krui_getFirstSiteTableEntry( char * *site_name, char * *site_func );
  821. /*  Returns the first site name/function pair in the site table.
  822.     Returns FALSE and NULL, if not available.
  823. */
  824.  
  825. bool  krui_getNextSiteTableEntry( char * *site_name, char * *site_func );
  826. /*  Returns the next site name/function pair in the site table.
  827.     Returns FALSE and NULL, if not available.
  828. */
  829.  
  830. char  *krui_getSiteTableFuncName( char  *site_name );
  831. /*  Returns the name of the site function that is associated with
  832.     the site name.
  833.     If the site name do not exist, function returns NULL.
  834. */
  835.  
  836. krui_err  krui_createSiteTableEntry( char  *site_name, char  *site_func );
  837. /*  Creates a new site name and associate this name with a site
  838.     function.
  839.     Returns error code if:
  840.      - site name already exists or
  841.      - site function is invalid or
  842.      - memory allocation has failed
  843.     0 otherwise.
  844. */
  845.  
  846. krui_err  krui_changeSiteTableEntry( char  *old_site_name, char  *new_site_name, char  *new_site_func );
  847. /*  Changes the site function of a previously defined site name.
  848.     Returns error code if <old_site_name> or <new_site_func>
  849.     are not defined, 0 otherwise.
  850.  
  851. NOTE: All sites in the network with the name <old_site_name>
  852.       changes their names and functions.
  853. */
  854.  
  855. krui_err  krui_deleteSiteTableEntry( char *site_name );
  856. /*  Removes the current site name entry from the site table.
  857.  
  858.     Returns an error code if there exists sites in the network
  859.     with the given name, 0 otherwise.
  860. */
  861.  
  862. /*#################################################
  863.  
  864. GROUP: Site Functions
  865.  
  866. #################################################*/
  867.  
  868. bool  krui_setFirstSite( void );
  869. /*  Initializes the first site at the current unit.
  870.     Returns false if no site available or if no sites permitted
  871.     at this unit.
  872. */
  873.  
  874. bool  krui_setNextSite( void );
  875. /*  Initializes the next site at the current unit.
  876.     Returns false if no more sites available.
  877. */
  878.  
  879. krui_err  krui_setSite( char    *site_name );
  880. /*  Initializes the given site at the current unit.
  881.     Returns error code if
  882.      - unit dosn't exist
  883.      - site name doesn't exist
  884.      - unit don't has sites
  885.      - unit don't has a site with this name
  886.     0 otherwise.
  887. */
  888.  
  889.  
  890. FlintType  krui_getSiteValue( void );
  891. /*  Returns the actual value of the current site.
  892. */
  893.  
  894. char  *krui_getSiteName( void );
  895. /*  Returns the name of the current unit/site,
  896.     NULL if not available.
  897. */
  898.  
  899. krui_err  krui_setSiteName( char  *site_name );
  900. /*  Sets the name/function of the current unit/site.
  901.     Current Unit will loose the functionality type.
  902.     Returns error code if site name isn't defined.
  903. */
  904.  
  905. char  *krui_getSiteFuncName( void );
  906. /*  Returns the name of the current unit/site function.
  907. */
  908.  
  909. krui_err  krui_addSite( char *  site_name );
  910. /*  Adds a site at the current unit. If the unit has already sites, this new
  911.     site will be inserted above all other sites, i.e. the new created site will
  912.     be the first site at this unit.
  913.     If the unit has direct input links, i.e the unit has input links
  914.     but no sites, the creation of sites is not permitted (krui_addSite will
  915.     return an error code).
  916.     If there exists already a site with the given name, the creation of the
  917.     new site is prohibited and krui_addSite returns an error code.
  918.  
  919.     krui_addSite has no effect on the current site. To change the current site
  920.     to this new site, call krui_setFirstSite().
  921.     The unit's FType will be deleted.
  922.  
  923.     Returns error code if
  924.       - memory allocation fails or
  925.       - unit has direct input links or
  926.       - site name isn't defined or
  927.       - site with the given name exists already at this unit
  928.       0 otherwise.
  929.  
  930. NOTE: The number of sites per unit is nearly unlimited (2^32).
  931. */
  932.  
  933.  
  934. bool  krui_deleteSite( void );
  935. /*  Removes the current site at the current unit and removes all
  936.     links from predecessor units to this site.
  937.     krui_setFirstSite (krui_setNextSite) must be called at least once
  938.     before using this function.
  939.     The current site will be set to the next available site, if no more
  940.     sites available, krui_deleteSite returns 0 otherwise 1.
  941.     Returns an error code if ther was a problem.
  942.     The unit's FType will be set to 0, i.e. the unit's functionality
  943.     type will be deleted.
  944.  
  945. NOTE: To delete all sites at a unit:
  946.         if ( krui_setFirstSite() )
  947.           while ( krui_deleteSite() > 0) { }
  948. */
  949.  
  950.  
  951. /*#################################################
  952.  
  953. GROUP: Link Functions
  954.  
  955. #################################################*/
  956.  
  957. int  krui_getFirstPredUnit( FlintType  *strength );
  958. /*  Returns the no. of first predecessor unit of the current unit/site
  959.     and the connection strenght.
  960.     Returns 0 if no predecessor unit available, i.e. if the current
  961.     unit and/or site has no inputs.
  962.  
  963. NOTE: If a predecessor unit exists, the current link is set to the link
  964.       between the two units.
  965. */
  966.  
  967. int  krui_getNextPredUnit( FlintType   *strength );
  968. /*  Returns the no. of the next predecessor unit of the current
  969.     unit/site and the connection strenght.
  970.     Returns 0 if no more predecessor units exists.
  971. NOTE: If another predecessor unit exists, the current link is set to the link
  972.       between the two units.
  973. */
  974.  
  975. int  krui_getCurrentPredUnit( FlintType   *strength );
  976. /*  Returns the no. of the current predecessor unit (of the current
  977.     unit/site) and the connection strenght.
  978.     Returns 0 if no predecessor unit available, i.e. if the current unit
  979.     and/or site has no inputs.
  980. */
  981.  
  982. int  krui_getFirstSuccUnit( int  UnitNo, FlintType   *strength );
  983. /*  Returns the no. of the first successor unit of the unit <source_unit_no>
  984.     and the connection strenght.
  985.     Returns (negative) error code if unit doesn't exist.
  986.     Returns 0 if no successor unit available, i.e. if the given unit
  987.     has no output connection.
  988.  
  989. IMPORTANT: If a successor unit exists, the current unit and site will be
  990.            set to this successor unit and the attached site.
  991.  
  992. NOTE: This function is slow (Units are backward chained only).
  993.  
  994. REMARK: getFirstSuccUnit is for downward compatibility only.
  995.         Do not use this function in future applications.
  996. */
  997.  
  998.  
  999. int  krui_getNextSuccUnit( FlintType  *strength );
  1000. /*  Returns the no. of the next successor unit and the connection strenght.
  1001.  
  1002. IMPORTANT: If a successor unit exists, the current unit and site will be
  1003.            set to this successor unit and the attached site.
  1004.  
  1005. NOTE: This function is slow  (Units are backward chained only)
  1006.  
  1007. REMARK: getNextSuccUnit is for downward compatibility only.
  1008.         Do not use this function in future applications.
  1009. */
  1010.  
  1011.  
  1012. bool krui_areConnected( int source_unit_no, int target_unit_no,
  1013.                         FlintType   *weight );
  1014. /*  Returns true if there exists a connection between source unit <source_unit_no>
  1015.     and target unit <target_unit_no>, otherwise false. If there exist a
  1016.     connection between these units, krui_areConnected returns the connection
  1017.     strength also.
  1018.     Returns FALSE if unit doesn't exist.
  1019.  
  1020. IMPORTANT: If there exist a connection, the current unit and site will be
  1021.            set to the target unit and the attached site.
  1022.  
  1023. NOTE: This function is slow (Units are backward chained only).
  1024. */
  1025.  
  1026. bool krui_isConnected( int  source_unit_no );
  1027. /*  True if there exists a connection between source unit <source_unit_no>
  1028.     and the current unit/site, otherwise false.
  1029.  
  1030. NOTE: If there exists a connection between the two units, the current link is set
  1031.       to the link between the two units. (alter the link weight with krui_setLinkWeight)
  1032. */
  1033.  
  1034. FlintType  krui_getLinkWeight( void );
  1035. /*  Returns the link weight of the current link.
  1036. */
  1037.  
  1038. void  krui_setLinkWeight( FlintTypeParam  strength );
  1039. /*  Sets the link weight of the current link.
  1040. */
  1041.  
  1042. krui_err  krui_createLink( int source_unit_no, FlintTypeParam  strength  );
  1043. /*  Creates a link between source unit and the current unit/site.
  1044.     Returns an error code:
  1045.      - if memory allocation fails
  1046.      - if source unit doesn't exist or
  1047.      - if there exists already a connection between current unit/site and
  1048.        the source unit
  1049.     0 otherwise.
  1050.     krui_createLink DO NOT set the current link.
  1051.  
  1052. NOTE: If you want to create a link and its unknown if there exists already a
  1053.       connection between the two units, use krui_createLink and test the return
  1054.       code, instead of the sequence krui_isConnected and krui_createLink.
  1055. */
  1056.  
  1057. krui_err  krui_deleteLink( void );
  1058. /*  Deletes the current link.
  1059.  
  1060. NOTE: To delete a link between the current unit/site and the source unit
  1061.       <source_unit_no>, call krui_isConnected( source_unit_no ) and
  1062.       krui_deleteLink().
  1063. */
  1064.  
  1065. krui_err  krui_deleteAllInputLinks( void );
  1066. /*  Deletes all input links at current unit/site.
  1067. */
  1068.  
  1069. krui_err  krui_deleteAllOutputLinks( void );
  1070. /*  Deletes all output links at current unit.
  1071. NOTE: This function is slow.
  1072. */
  1073.  
  1074. void  krui_jogWeights( FlintTypeParam  minus, FlintTypeParam  plus);
  1075. /*  Add uniform distributed random values to connection weights.
  1076.     <minus> must be less then <plus>.
  1077. */
  1078.  
  1079.  
  1080.  
  1081. /*#################################################
  1082.  
  1083. GROUP: Functions for network updating
  1084.  
  1085. #################################################*/
  1086.  
  1087. krui_err  krui_updateSingleUnit( int  UnitNo );
  1088. /*  Updates a single unit. Returns error code if unit doesn't exist,
  1089.     0 otherwise.
  1090.  
  1091. NOTE: Updates also frozen Units.
  1092. */
  1093.  
  1094. char  *krui_getUpdateFunc( void );
  1095. /*  Returns the current update function. The default update function is
  1096.     SerialOrder() (see also kr_def.h).
  1097. */
  1098.  
  1099. krui_err  krui_setUpdateFunc( char  *update_func );
  1100. /*  Changes the current update function.  Returns error code if update
  1101.     function is invalid.
  1102. */
  1103.  
  1104. krui_err  krui_updateNet( float *parameterArray, int  NoOfParams );
  1105. /*  Updates the network according to update function:
  1106.  
  1107.       To propagate a pattern thru the network the use of following
  1108.       function calls is recommended:
  1109.  
  1110.         krui_setPatternNo( pat_no );
  1111.         krui_showPattern( OUTPUT_NOTHING );
  1112.         krui_updateNet( parameterArray, NoOfParams );
  1113.  
  1114.       See also krui_setSeedNo for initializing the pseudo
  1115.       random generator.
  1116.  
  1117.       Returns error code if an error occured, 0 othrwise.
  1118.  
  1119. NOTE: The network should be feedforward in topological mode,
  1120.       otherwise function will return a warning message.
  1121. */
  1122.  
  1123. krui_err  krui_testNet( int  pattern_no, 
  1124.                         float  *updateParameterArray, int  NoOfUpdateParams,
  1125.                         float  *parameterInArray, int  NoOfInParams,
  1126.                         float  * *parameterOutArray, int  *NoOfOutParams );
  1127. /*  Calculates the network error whith the given pattern.
  1128.     Uses the current update function to propagate the network.
  1129.  
  1130.     UpdateParameterArray contains the parameters of the update function.
  1131.     NoOfUpdateParams contains the number of input parameters of the update function.
  1132.  
  1133.     parameterInArray[0] contains the max. devitation.
  1134.     Set NoOfInParams to 1.
  1135.  
  1136.     parameterOutArray[0] contains the error of the network/pattern,
  1137.     parameterOutArray[1] contains the number of output units with a
  1138.     higher error value than the given max. devitation.
  1139.     NoOfOutParams will be set to 2.
  1140.  
  1141. NOTE: Patterns must be loaded before calling this function.
  1142.  
  1143. Returns error code if an error occured, 0 otherwise.
  1144. */
  1145.  
  1146.  
  1147. /*#################################################
  1148.  
  1149. GROUP: Functions for network initialisation
  1150.  
  1151. #################################################*/
  1152.  
  1153. char  *krui_getInitialisationFunc( void );
  1154. /*  Returns the current initialisation function. The default initialisation function is
  1155.     Randomize_Weights (see also kr_def.h).
  1156. */
  1157.  
  1158. krui_err  krui_setInitialisationFunc( char  *init_func );
  1159. /*  Changes the current initialisation function.  Returns error code if initialisation
  1160.     function is invalid.
  1161. */
  1162.  
  1163. krui_err  krui_initializeNet( float *parameterArray, int  NoOfParams );
  1164. /*  Initializes the network
  1165. */
  1166.  
  1167.  
  1168. /*#################################################
  1169.  
  1170. GROUP: Learning Functions
  1171.  
  1172. #################################################*/
  1173.  
  1174. char  *krui_getLearnFunc( void );
  1175. /*  Returns the name of the current learning function.
  1176. */
  1177.  
  1178. krui_err  krui_setLearnFunc( char  *learning_func );
  1179. /*  Changes the learning function. Returns a error code if the
  1180.     given learning function is invalid.
  1181. */
  1182.  
  1183. krui_err  krui_learnAllPatterns( float   *parameterInArray, int NoOfInParams,
  1184.                                  float  * *parameterOutArray, int *NoOfOutParams );
  1185. /*  Learn all pattern pairs using current learning method.
  1186.     parameterInArray contains the learning
  1187.     parameter(s). NoOfInParams stores the number of learning parameters.
  1188.     parameterOutArray returns the results from the learning function.
  1189.     this array is a static array defined in the learning function.
  1190.     *NoOfOutParams points to a integer value that contains the number
  1191.     of output parameters from the current learning function.
  1192.     Returns an error code if memory allocation has failed or if
  1193.     the parameters are invalid.
  1194.  
  1195.     Returns error code of the learning function.
  1196. REMEMBER:  The backpropagation learning function takes the learning
  1197.            parameter from parameterInArray[ 0 ]. parameterOutArray[ 0 ]
  1198.            returns the current net error.
  1199.  
  1200. NOTE: Patterns must be loaded before calling this function.
  1201. */
  1202.  
  1203. krui_err  krui_learnSinglePattern( int  pattern_no, float   *parameterInArray,
  1204.                                    int NoOfInParams,
  1205.                                    float  * *parameterOutArray, int *NoOfOutParams );
  1206. /*  Same as krui_learnAllPatterns( ... ) but learns only the current
  1207.     pattern pair.
  1208.  
  1209. NOTE: Patterns must be loaded before calling this function.
  1210. */
  1211.  
  1212. krui_err  krui_setPatternNo( int  patter_no );
  1213. /*  Sets the current pattern.
  1214.     Returns a error code if pattern number is invalid.
  1215.  
  1216. NOTE: Patterns must be loaded before calling this function.
  1217. */
  1218.  
  1219. krui_err  krui_deletePattern( void );
  1220. /*  Deletes the current pattern.
  1221. */
  1222.  
  1223. krui_err  krui_modifyPattern( void );
  1224. /*  Modifies the current pattern.
  1225. */
  1226.  
  1227. krui_err  krui_showPattern( int  mode );
  1228. /*  According to the mode krui_showPattern stores the current
  1229.     Pattern into the units activation (and/or output) values.
  1230.     The modes are:
  1231.       - OUTPUT_NOTHING
  1232.          store input pattern into input units activations
  1233.       - OUTPUT_ACT
  1234.          store input pattern into input units activations and
  1235.          store output pattern into output units activations
  1236.       - OUTPUT_OUT
  1237.          store input pattern into input units activations,
  1238.          store output pattern into output units activations and
  1239.          update output units output
  1240.  
  1241. NOTE: See include file glob_typ.h for mode constants.
  1242. */
  1243.  
  1244. krui_err  krui_newPattern( void );
  1245. /*  Creates a new pattern pair.
  1246.     A pattern pair can be created by modifying the activation
  1247.     value of the input/output units.
  1248.     Returns error code if memory is insufficent or no. of
  1249.     input/output units is incompatible, 0 otherwise.
  1250.  
  1251. NOTE: krui_newPattern switches pattern shuffeling off.
  1252.       For shuffeling the new pattern pairs call
  1253.         krui_newPattern(...)
  1254.         krui_shufflePattern( TRUE )
  1255. */
  1256.  
  1257.  
  1258. int  krui_getNoOfPatterns( void );
  1259. /*  Returns the no. of available pattern pairs.
  1260. */
  1261.  
  1262.  
  1263. void  krui_deleteAllPatterns( void );
  1264. /*  Release previously defined patterns from memory.
  1265.     Call krui_releasePatterns() if you want to create totally
  1266.     new patterns with krui_newPattern().
  1267. */
  1268.  
  1269. krui_err  krui_shufflePatterns( bool  on_or_off );
  1270. /*  Shuffle pattern pairs by using pseudo random generator.
  1271.     Returns error code if memory allocation fails.
  1272.     Shuffeling of patterns is used by krui_learnAllPatterns(...).
  1273.     krui_shufflePatterns( TRUE ) switches shuffeling of patterns
  1274.     on, krui_shufflePatterns( FALSE ) switches shuffeling of
  1275.     patterns off.
  1276.     The default presetting is krui_shufflePatterns( FALSE ).
  1277.  
  1278. NOTE:  See also krui_setSeedNo( seed )
  1279. */
  1280.  
  1281.  
  1282. /*#################################################
  1283.  
  1284. GROUP: I/O Functions
  1285.  
  1286. #################################################*/
  1287.  
  1288. krui_err  krui_loadNet( char  *filename, char  * *netname );
  1289. /*  Load a network file and create a network.
  1290.     Returns the name of the net or "UNTITLED" if unknown.
  1291.     Returns error code if an error occured during
  1292.     loading/memory allocation, or 0 otherwise.
  1293. */
  1294.  
  1295. krui_err  krui_saveNet( char  *filename, char  *netname);
  1296. /*  Save a network.
  1297.     If netname is a NULL pointer, the net will get the name "UNTITLED"
  1298.     Returns error code if an error occured, or 0 otherwise.
  1299. */
  1300.  
  1301. /*#################################################
  1302.  
  1303. GROUP: Functions for reading/searching the symbol table
  1304.        The symbol table holds the names and types of all symbols
  1305.        (unit and site symbols).
  1306.  
  1307. #################################################*/
  1308.  
  1309. bool  krui_getFirstSymbolTableEntry( char * *symbol_name, int  *symbol_type );
  1310. /*  Returns the first symbol/symbol type entry in the
  1311.     symbol table. Returns true if this entry is available,
  1312.     false otherwise.
  1313. */
  1314.  
  1315. bool  krui_getNextSymbolTableEntry( char * *symbol_name, int  *symbol_type );
  1316. /*  Returns the next symbol/symbol type entry in the
  1317.     symbol table. Returns true if another entry is available,
  1318.     false otherwise.
  1319.  
  1320. Example:  To get all symbols in the symbol table
  1321.           if (krui_getFirstSymbolTableEntry( &symbol, &symtype))
  1322.             do
  1323.               {
  1324.                 .
  1325.                 .
  1326.                 .
  1327.               }
  1328.             while (krui_getNextSymbolTableEntry( &symbol, &symtype));
  1329. */
  1330.  
  1331.  
  1332. bool  krui_symbolSearch( char * symbol, int  symbol_type);
  1333. /*  Searches the symbol table for a given symbol and
  1334.     symbol type (unit name symbol, site name symbol,
  1335.     functionality unit name symbol)
  1336.     Returns true, if the symbol exists.
  1337. */
  1338.  
  1339. /*#################################################
  1340.  
  1341. GROUP: Miscellanous
  1342.  
  1343. #################################################*/
  1344.  
  1345.  
  1346. char  *krui_getVersion( void );
  1347. /*  Returns the current Version of the SNNS-Kernel.
  1348. */
  1349.  
  1350. void  krui_getNetInfo( int  *no_of_sites, int  *no_of_links,
  1351.                        int  *no_of_STable_entries, int  *no_of_FTable_entries );
  1352. /*  Returns miscellanous information about the current network.
  1353. */
  1354.  
  1355. void  krui_getUnitDefaults( FlintType  *act, FlintType  *bias, int  *st,
  1356.                             int  *subnet_no, int  *layer_no,
  1357.                             char * *act_func, char  * *out_func );
  1358. /*  Returns Information about the unit default settings.
  1359.     For more information about default settings see krui_createDefaultUnit() and
  1360.     krui_createFTypeUnit( .. ).
  1361. */
  1362.  
  1363. krui_err  krui_setUnitDefaults( FlintTypeParam  act, FlintTypeParam  bias, int  st,
  1364.                                 int  subnet_no, int  layer_no,
  1365.                                 char  *act_func, char  *out_func );
  1366. /*  Changes the unit default settings.
  1367.     For more information about default settings see krui_createDefaultUnit() and
  1368.     krui_createFTypeUnit( .. ).
  1369.  
  1370.     Returns error code if
  1371.      - activation/output function is invalid
  1372.      - Topologic type is invalid
  1373.     0 otherwise.
  1374. */
  1375.  
  1376.  
  1377.  
  1378. void  krui_setSeedNo( long seed );
  1379. /*  Initialize the pseudo random generator.
  1380.     0 as argument reinitializes the random generator.
  1381. */
  1382.  
  1383.  
  1384. int  krui_getNoOfInputUnits( void );
  1385. /*  Returns no. of input units
  1386. */
  1387.  
  1388. int  krui_getNoOfOutputUnits( void );
  1389. /*  returns no. of output units
  1390. */
  1391.  
  1392. int  krui_getNoOfTTypeUnits( int  UnitTType );
  1393. /*  returns the no. of units of the specified topologic type
  1394.     (i.e. Input, Hidden, Output, Dual or Special units)
  1395. */
  1396.  
  1397. void  krui_resetNet( void );
  1398. /*  Reset the network by changeing the unit activation
  1399.     to the initial activation value.
  1400. */
  1401. char  *krui_error( int  error_code );
  1402. /*  Returns an error message, depending on the error code.
  1403.     If a function returns an error code use krui_error to
  1404.     get the message.
  1405.  
  1406. Available error messages are:
  1407.  
  1408. "Invalid error code",
  1409. "Insufficient memory",
  1410. "Invalid unit number",
  1411. "Invalid unit output function",
  1412. "Invalid unit activation function",
  1413. "Invalid site function",
  1414. "Creation of sites isn't permitted because unit has direct input links",
  1415. "Creation of a link isn't permitted because there exists already a link between these units",
  1416. "Memory allocation failed during critical operation. Have lost some pointers, but consistency of the network is guaranteed",
  1417. "Ftype name isn't definite",
  1418. "Current Ftype entry isn't defined",
  1419. "Invalid copy mode",
  1420. "Current unit doesn't have sites",
  1421. "Can't update unit because unit is frozen",
  1422. "Redefinition of site name isn't permitted (site name already exists)",
  1423. "Site name isn't defined",
  1424. "This is not a 3D-Kernel",
  1425. "This unit has already a site with this name",
  1426. "Can't delete site table entry because site is in use",
  1427. "Current Ftype site isn't defined",
  1428. "Ftype symbol isn't defined",
  1429. "Physical I/O error",
  1430. "Creation of output file failed (line length limit exceeded)",
  1431. "The network has not enough layers: ",
  1432. "No Units defined",
  1433. "Unexpected EOF",
  1434. "Line length exceeded",
  1435. "Incompatible file format",
  1436. "Can't open file",
  1437. "Syntax error at line",
  1438. "Memory allocation error 1",
  1439. "Topologic type invalid",
  1440. "Symbol pattern invalid (must match [A-Za-z]^[|, ]*)",
  1441. "Current unit doesn't have a site with this name",
  1442. "No hidden units defined",
  1443. "Network contains cycle(s): ",
  1444. "Network contains dead unit(s): ",
  1445. "Pattern file contains not the same no. of input units as the network",
  1446. "Pattern file contains not the same no. of output units as the network",
  1447. "No. of input units have changed",
  1448. "No. of output units have changed",
  1449. "No input units defined",
  1450. "No output units defined",
  1451. "No patterns defined",
  1452. "In-Core patterns incompatible with current network (remove In-Core patterns before loading a new network)",
  1453. "Invalid pattern number",
  1454. "Invalid learning function",
  1455. "Invalid parameters",
  1456. "Invalid update function",
  1457. "Invalid initialisation function",
  1458. "Derivation function of the activation function doesn't exist",
  1459. "Input unit(s) with input connection(s) to other units: ",
  1460. "Output unit(s) with output connection(s) to other units: ",
  1461. "Invalid topological sorting mode",
  1462. "Learning function doesn't support sites",
  1463. "Sites are not supported",
  1464. "This isn't a MasPar Kernel",
  1465. "Connection(s) between unit(s) in non-neighbour layers are not supported: ",
  1466. "The network has too much layers: ",
  1467. "The network layers aren't fully connected",
  1468. "This operation isn't allowed in the superscalar kernel mode",
  1469. "Change of network type isn't possible in superscalar kernel mode",
  1470. "No current link defined",
  1471. "No current unit defined",
  1472. "Current unit doesn't have any inputs",
  1473. "Invalid parameter in topologic definition section",
  1474. "Creation of link between these units isn't permitted",
  1475. "MasPar don't respond",
  1476. "This function isn't implemented yet",
  1477. "Kernel isn't in parallel mode",
  1478. "MasPar ran out of memory",
  1479. "MasPar communication error",
  1480. "MasPar ran out of processors",
  1481. "Missing default function (check function table)",
  1482. "MasPar kernel doesn't support multiple unit output functions",
  1483. "MasPar kernel doesn't support multiple unit activation functions",
  1484. "The depth of the network doesn't fit to the learning function"
  1485.  
  1486.  
  1487. */
  1488.  
  1489.  
  1490. /*#################################################
  1491.  
  1492. GROUP: Functions for memory management
  1493.  
  1494. #################################################*/
  1495.  
  1496. krui_err  krui_allocateUnits( int  number );
  1497. /*  Allocates a given number of units, additional units
  1498.     may allocated by calling this function again.
  1499.     This function is called automatically if the user
  1500.     construct more units than have been allocated before, but
  1501.     it is recommended to use this function if a large amount
  1502.     of units is needed (the UNIX System can manage system resources
  1503.     much better, if the amount of memory used for the network is
  1504.     approximately known before the network is created).
  1505.  
  1506.     Returns error code if memory allocation fails, 0 otherwise.
  1507.  
  1508. NOTE: If krui_create_unit has been called before using this
  1509.       function, at least <UNIT_BLOCK> numbers of units have been
  1510.       allocated.
  1511.       See "kr_def.h" for more information about memory allocation
  1512.       block sizes.
  1513. */
  1514.  
  1515. void  krui_getMemoryManagerInfo( int  *unit_bytes, int  *site_bytes, int  *link_bytes,
  1516.                                  int  *NTable_bytes, int  *STable_bytes, int  *FTable_bytes );
  1517. /*  Returns the number of ALLOCATED (not the number of USED) bytes
  1518.     for the units, sites, name-table and site-table.
  1519. */
  1520.  
  1521. void  krui_deleteNet( void );
  1522. /*  Delete network, names and unit types.
  1523.     Frees all memory used for the network.
  1524.  
  1525. NOTE: If krui_loadNet is called more then once,  krui_deleteNet will
  1526.       be called by krui_loadNet, because the kernel have to free the
  1527.       memory used for the old network.
  1528.       It is recommended (but not neccessary) to call krui_deleteNet
  1529.       before terminating  program.
  1530. */
  1531.  
  1532.  
  1533. /* #############################################################
  1534.  
  1535.   Functions for the extern kernels
  1536.  
  1537. ############################################################# */
  1538.  
  1539. krui_err  krui_setSpecialNetworkType( int  net_type );
  1540. /*  Sets the topologic type of the current network.
  1541.     Returns an error if the topologic type of the current network  
  1542.     doesn't fit to this type.
  1543.     Topologic types are:
  1544.       - NET_TYPE_GENERAL
  1545.         general purpose network type with no limitations
  1546.       - NET_TYPE_FF1
  1547.         feedforward network with fully connected units in
  1548.         neighbour layers
  1549. */
  1550.  
  1551. int  krui_getSpecialNetworkType( void );
  1552. /*  Returns the special topologic type of the current network, if set.
  1553. */
  1554.  
  1555. int krui_initInversion(void);
  1556. void  krui_inv_forwardPass(struct UnitList *inputs);
  1557. double krui_inv_backwardPass(float learn, float delta_max, int *err_units, 
  1558.                  float ratio, struct UnitList *inputs,
  1559.                  struct UnitList *outputs);
  1560.  
  1561. #ifdef MASPAR_KERNEL
  1562.  
  1563. /* #############################################################
  1564.  
  1565.   Functions for the parallel kernel
  1566.  
  1567. ############################################################# */
  1568.  
  1569. krui_err  krui_MasPar( int  mode );
  1570. /*  Connects and Disconnects the MasPar.
  1571.     The mode switches are:  MASPAR_CONNECT, MASPAR_DISCONNECT and
  1572.     MASPAR_NOT_AVAILABLE.
  1573. */
  1574.  
  1575.  
  1576. krui_err  krui_getMasParStatus( void );
  1577. /*  Returns the status of the MasPar.
  1578. */
  1579.  
  1580. krui_err  krui_MasParBenchmark( int  func_type, int cycles, float  *result );
  1581. /*  Perform benchmark tests
  1582. */
  1583.  
  1584. #endif
  1585.  
  1586.